package controller;

import java.awt.event.KeyEvent;

import csel.controller.enums.ActionEnum;
import csel.controller.events.KeyPress;
import csel.controller.bindings.KeyBindings;
import csel.controller.decoders.EventDecoder;
import csel.controller.dispatchers.Dispatcher;
import csel.model.GameCommand;
import csel.model.Invoker;

public class TestThatKeyDecoderShitSon
{
	public static void main(String[] ags) throws InterruptedException
	{
		Dispatcher disp = new Dispatcher(new Thing());
		disp.startDispatcher();
		
		EventDecoder<KeyPress> decoder = new KeyEventDecoder( null, disp );
		Thread coolThread = new Thread( decoder );
		coolThread.start();
		
		decoder.registerEvent( new EventThinger(null, null) );
		decoder.registerEvent( new EventThinger(null, null) );
		decoder.registerEvent( new EventThinger(null, null) );
		decoder.registerEvent( new EventThinger(null, null) );
		decoder.registerEvent( new EventThinger(null, null) );
		decoder.registerEvent( new EventThinger(null, null) );
		decoder.registerEvent( new EventThinger(null, null) );
		decoder.registerEvent( new EventThinger(null, null) );
		decoder.registerEvent( new EventThinger(null, null) );
		decoder.registerEvent( new EventThinger(null, null) );
		decoder.registerEvent( new EventThinger(null, null) );
		
		Thread.sleep( 1000 );
		coolThread.interrupt();
		disp.stopDispatcher();
	}
	
	private static class Thing implements Invoker
	{
		public void accept(GameCommand gc)
		{
			gc.execute();
		}
	}
	
	private static class EventThinger extends KeyPress
	{
		public EventThinger(KeyEvent event, KeyBindings keyBindings)
		{
			super(event, keyBindings);
			// TODO Auto-generated constructor stub
		}

		public ActionEnum getActionEnum()
		{
			return ActionEnum.CHANGE_SUBVIEW;
		}
	}
	
	
}
